package pieces;

import java.util.ArrayList;
import model.*;

/**
 * This class is a subclass of Pieces that is extended by {@link pieces.Rook}, {@link pieces.Bishop}, and {@link pieces.Queen}
 * @author Sacha Best
 */
public abstract class SideMover extends Piece
{
	public SideMover(Location loc, GridGame<Piece> grid, int id, int color)
	{
		super(loc, grid, id, color);
	}
	public ArrayList<Location> getLocationsInDirection(int direction)
	{
		ArrayList<Location> returned = new ArrayList<Location>();
		Location tempLoc = getLocationInDirection(direction);
		while (tempLoc != null && grid.inBounds(tempLoc) && grid.getObjectAt(tempLoc) == null)
		{
			returned.add(tempLoc);
			tempLoc = tempLoc.getAdjacentLocation(direction);
		}
		if (tempLoc != null && grid.inBounds(tempLoc))
			returned.add(tempLoc);
		return returned;
	}
	@Override
	public abstract ArrayList<Location> getMoveLocations();
}
